﻿using System;
using DapperExtensions.Mapper;

namespace Read.Models
{
    public class AdminMapper : ClassMapper<AdminModel>
    {
        /// <summary>
        /// 字段映射
        /// </summary>
        public AdminMapper()
        {
            Table(Tables.Admin);
            Map(c => c.Id).Column("Id").Key(KeyType.Identity);
            Map(c => c.UserName).Column("UserName");
            Map(c => c.Password).Column("Password");
            Map(c => c.BindAccount).Column("BindAccount");
            Map(c => c.LastLoginTime).Column("LastLoginTime");
            Map(c => c.LastLoginIp).Column("LastLoginIp");
            Map(c => c.Verify).Column("Verify");
            Map(c => c.Email).Column("Email");
            Map(c => c.Remark).Column("Remark");
            Map(c => c.CreateTime).Column("CreateTime");
            Map(c => c.UpdateTime).Column("UpdateTime");
            Map(c => c.Status).Column("Status");
            Map(c => c.RoleId).Column("RoleId");
            Map(c => c.RoleText).Column("RoleText");
        }
    }
    public class AdminModel
    {
        /// <summary>
        /// 用户Id
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }

        /// <summary>
        /// 绑定帐户
        /// </summary>
        public string BindAccount { get; set; }

        /// <summary>
        /// 上次登录时间
        /// </summary>
        public int LastLoginTime { get; set; }

        /// <summary>
        /// 上次登录IP
        /// </summary>
        public string LastLoginIp { get; set; }

        /// <summary>
        /// 证验码
        /// </summary>
        public string Verify { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        ///备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public int CreateTime { get; set; }

        /// <summary>
        ///更新时间
        /// </summary>
        public int UpdateTime { get; set; }

        /// <summary>
        ///状态
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        ///对应角色ID
        /// </summary>
        public int RoleId { get; set; }

        /// <summary>
        /// 角色的名称显示
        /// </summary>
        public string RoleText { get; set; }
    }
}
